package com.itheima.test;

import java.time.LocalDate;
import java.time.Period;

public class Demo_015 {
    public static void main(String[] args) {
        //public static Period between(开始时间,结束时间)  计算两个"时间"的间隔
        LocalDate start = LocalDate.of(2020, 11, 11);
        LocalDate end = LocalDate.of(2010, 1, 23);
        Period between = Period.between(end,start);
        System.out.println(between);
        //public int getYears()         获得这段时间的年数
        int years = between.getYears();
        System.out.println(years);
        int months = between.getMonths();
        System.out.println(months);
        int days = between.getDays();
        System.out.println(days);
    }
}
